package solution;

/**
 * LCR 166. 珠宝的最高价值
 * https://leetcode.cn/problems/li-wu-de-zui-da-jie-zhi-lcof/description/
 */
class Solution2 {
    public int jewelleryValue(int[][] frame) {
        //dp表22
        int row = frame.length;//行
        int col = frame[0].length;//列
        int[][] dp = new int[row + 1][col + 1];
        //遍历dp表
        for(int i = 1; i < row + 1; i++) {
            for(int j = 1; j < col + 1; j++) {
                dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1])  + frame[i - 1][j - 1];
            }
        }
        return dp[row][col];
    }
}